1. Field of the Invention
The present invention relates to an improvement of a data transmission arrangement (apparatus and method) for data transmission between a portable electronic device such as an IC card and an external device.
2. Description of the Related Art
Recently, an IC card has been developed as a new type of portable data storing medium. The IC card contains an IC chip having a non-volatile memory section and a control section such as a CPU for controlling the memory section. As shown in FIG. 1, a data memory 21 built in this type of IC card has a plurality of areas having different storage capacities, and each area contains a plurality of record data items. Depending on the types of application software, the areas are divided, and the record data items are divided as units of data.
The IC card receives a storage demand data item from a card reader/writer serving as an external device. In this case, a data item to be stored is handled as a unit of a record data item.
The record data item is called a "record format". The record format consists of a length data item, which indicates the length of a storage data item, and the storage data corresponding to the the length data item.
The IC card has a function for storing a record format as it is, and a function for outputting the record format in response to a readout demand. A record data item to be retrieved is recognized and selected from among the record data items stored in a predetermined area of the data memory 21. On the other hand, the card reader/writer has the function for recognizing the record data item output from the data memory 21.
The amount of a message to be processed in a single transmission operation between the IC card and the card reader/writer is limited by the capacity of a buffer memory (not shown), for the input/output of the IC card, and by transmission regulations. Depending on the capacity and the contents of the regulations, several transmission operations may be required for the processing of one record.
For example, in an IC card using a text format protocol consisting of a message start data (message start code), a data section and a message end data (message check code), as shown in FIG. 2, when the IC card receives a record readout command consisting of a data item 1 which is so large that it cannot be transmitted in one transmission operation, then its length data L1, the data item 1 is transmitted in the form of four response message components.
As shown in FIGS. 3A to 3D, a first response message consisting of a message start data item, a currently executed command (readout command), a record readout status data item or an executed result (normal readout of a target record data item), a length data item L1, a data section 1(1), and a message end data item. Each of second to fourth response messages consists of a message start data item, a data section 1(2), (1(3),or 1(4)), and a message end data item.
The status data item represents, as a response to the record data readout command, the meaning "normal readout of a target data item", "a target record data item is not present", or "message format does not correspond to a record readout command".
The card reader/writer evaluates the length of the target record data item, based on the length data L1 in the first response message from the IC card, as shown in FIG. 3, and performs the processing corresponding to the length of the target record data item.
Normally, when the IC card receives a readout command, it transmits the first to fourth response messages. It is supposed that the data readout is not smoothly performed and the transmission of data items is discontinued. In this case, as shown in FIG. 4, the IC card outputs an error response (or a record data item discontinuation response) to the card reader/writer in response to a continuous data demand command from the card reader/writer. Since the card reader/writer has received a status data item indicating "normal readout", which is included in the first message, the card reader/writer erroneously receives the record data item discontinuation response as a continuous record data item.
In order to avoid the erroneous operation of the card reader/writer, when data discontinuation occurs, the output of a sequence of output messages is at once stopped. Next, a continuation end data item is super-imposed on a message start data item of the last record data item which can be readout. When the card reader/writer receives the continuation end data item, it concludes that the output of data has stopped before all record data items are readout. Also, as shown in FIG. 5, the card reader/writer outputs a status data demand command to the IC card. Thus, the card reader/writer is required to output the status data demand command, though it could repeat the output of only continuous data demand commands if the transmission of data were normally continued.
This being the case, the conventional system has the following problem. Namely, where a plurality of messages corresponding to one command are transmitted between a card reader/writer and an IC card, even if a status data item, which is different from the status data item included in the first message, is output from the IC card to the card reader/writer, the card reader/writer cannot recognize it. If the card reader/writer is forcibly made to recognize the status data item, the transmission of data is discontinued.